home *** CD-ROM | disk | FTP | other *** search
- Stephen W. Cocks - America Online Stephen105 - Compuserve 71604,163
-
- These Visual Basic files are in the PUBLIC DOMAIN. They were compressed
- using PKWARE's pkzip.exe version 2.04g (registered). The files included
- are:
- drawfram.frm
- drawfram.mak
- readme.txt
-
- This program was written using Visual Basic 3.0 Professional Edition, but
- DOES NOT REQUIRE THE PROFESSIONAL EDITION.
-
- DrawFrameOn (the original) can be found in Richard Mansfield's book, "The
- Visual Guide to Visual Basic For Windows" on page 514, under LINE METHOD.
- I endorse Mr. Mansfield's book. Unlike other books that are organized
- Alphabetically by Visual Basic's Controls, Events, Functions, Methods,
- Properties, etc., this book punctuates its narrative with little applets
- that are more than just useful, they are thought provoking. Of the twelve
- manuals I have on VB, this one is the most dog eared.
-
- When I tried to make Mr. Mansfield's DrawFrameOn put a frame adjacent to a
- control (per his instructions), it left a one pixel gap on the right side
- and on the bottom. This isn't noticeable when the frame is more than (lets
- say) ten pixels away from the control, but it certainly won't do when it is
- supposed to abut the control.
-
- When you want to find the right-most position occupied by a control where
- you are given its left-most position and its width, you must add the left
- postion and the width and subtract one.
-
- right-most position = (Control.Left + Control.Width) - 1
-
- For example: Your command button's Left property is 3 and its width is 5, so
- it occupies positions 3, 4, 5, 6, 7. To find its right most position, you
- add its Left, 3, and Width, 5, and subtract 1.
-
- 7 = 3 + 5 - 1
-
- I also added colors to the large box Mr. Mansfield suggests drawing before
- adding the lines. When you draw the larger frames first and make the color
- of the smallest frame 7, or Light Gray, you can get the effect of filling
- frames with color. Some combinations of colors and frame styles "don't work"
- in that they aren't pleasing to the eye.
-
- DrawFrameOn (TopLeftControl As Control, BottomRightControl As Control, Style
- As String, FrameOffset As Integer, Color As Integer)
-
- Pass DrawFrameOn the names of the controls, "Raised" or "Inset", how many
- pixels you want from the controls border to the frame, and the color
- expressed as the integer used by QBColor(n).
-
- The TWIPS = Screen.TwipsPerPixelX instruction gathers an approximation of
- the twips per pixel (or so the manuals say) for your monitor. On my 15"
- SVGA monitor that measurement comes out 15 twips per pixel.
-
- This form has OPTION EXPICIT set so you must declare your variables.
-
- You may draw as many frames as you like varying their distance from each
- other and the colors inbetween to create the effect of ornate picture
- frames. I've found the dark colors are especially good for this kind of
- work.
-
- Stephen W. Cocks Compuserve 71604,163
-
-
-
-